package com.thm.tfast.core.task.base;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName TaskRegister
 * @Author THM
 * @Date 2022/11/2 9:00
 * @Version 1.0
 * @Description 任务注册器
 */
@Slf4j
@Component
public class TaskRegister {
    private final static List<AbstractTask> taskList = new ArrayList<>();


    public void register(AbstractTask task) {
        taskList.add(task);
        log.info("【{}】任务注册成功", task.getTaskName());
    }

    public List<AbstractTask> getTaskList() {
        return taskList;
    }

    public Integer getSize() {
        return taskList.size();
    }
}
